<html>
<body>
<?php
	require "configcmd.php";

	$ID = $_GET['ID'];
	$Balance = $_GET['Balance'];
	$Bal_limit = $_GET['Bal_limit'];
	$Status = $_GET['Status'];


	$con = mysql_connect("localhost",$db_user ,$db_pass);

	if (!$con){
		die('Could not connect: ' . mysql_error());
  	}
	
	mysql_select_db($db_name, $con);

	if ($Bal_limit < $Balance){

	die('Balance cannot exceed credit limits! ' . mysql_error());

	}else{

	$sql_edit = "UPDATE accounts SET Balance ='$Balance' WHERE ID = '$ID' ;" ;
	$sql_edit1 = "UPDATE accounts SET Bal_limit ='$Bal_limit' WHERE ID = '$ID' ;" ;
	$sql_edit2 = "UPDATE accounts SET Status ='$Status' WHERE ID = '$ID' ;" ;

	mysql_query($sql_edit);
	mysql_query($sql_edit1);
	mysql_query($sql_edit2);
	}
	
	mysql_close($con);
?>
<h1>Account successfully updated</h1>
</body>
<br />
<a href="Main.php">Home</a>
<a href="showaccounts.php">View Accounts</a>
</html>
